<?php
namespace api\test\Controller;
use api\test\model\StudentModel;
use think\db\Where;
use cmf\controller\RestBaseController;

Class StudentController extends RestBaseController
{
    public function getStudentList()
    {
        //分页
        $page = input('page') ? input('page') : 1;

        //搜索
        $name = input('name');

        $where = new Where();

        if ($name) {
            $where['name'] = ['like','%'.$name.'%'];
        }

        $data = StudentModel::where($where)
            ->page($page,4)
            ->select();

        $this->success('查询成功',$data);
    }
}